﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Retirement/retirement.master" AutoEventWireup="true" CodeFile="certificate.aspx.cs" Inherits="Retirement_Admin_certificate" %>

<asp:Content ID="Content" ContentPlaceHolderID="retirement_ContentPlaceHolder" Runat="Server">

    <h2 id="heading">
        <a href="../home.aspx">World Trade Bank</a> > <a href="~/retirement/admin/manageClients.aspx">
            Retirement</a> > <a href="manageClients.aspx">Clients</a> > Policy Certificate</h2>

    <style type="text/css"> 
        
        @media print
        {
        #non-printable { display: none; }
        #printable { display: block; }
        }
        
        .tbl_certificate td
        {
            text-align: left;
        }
        td.borderTopBottom
        {
         border-top-style: solid; 
         border-bottom-style: solid; 
         border-width: thin;
        }
        td.borderTop
        {
         border-top-style: solid;
         border-width: thin; 
        }
        td.borderBottom
        {
         border-bottom-style: solid;
         border-width: thin;
        }
    </style>

    <script type="text/javascript">
        function PrintElem() {
            //Popup($(elem).html());
            Popup($("#<%=this.fv_certificate.ClientID%>").html());
        }

        function Popup(data) {
            var mywindow = window.open('', 'Retirment', 'height=400,width=600');
            mywindow.document.write('<html><head><title>Retirment Certificate</title>');
            /*optional stylesheet*/ //mywindow.document.write('<link rel="stylesheet" href="main.css" type="text/css" />');
            mywindow.document.write('</head><body >');
            mywindow.document.write(data);
            mywindow.document.write('</body></html>');

            mywindow.document.close(); // necessary for IE >= 10
            mywindow.focus(); // necessary for IE >= 10

            mywindow.print();
            mywindow.close();

            return true;
        }

    </script>


<asp:FormView ID="fv_certificate" runat="server" 
        DataSourceID="SqlDataSource_Certificate">
   
<ItemTemplate>
<div id="printable">
<p style="font-family: 'Oxygen', Arial; font-weight: bold; font-size: 40px">
        Policy Certificate</p><br />

<table class="tbl_certificate" width="100%">
<tr>
<td>Specially prepared for</td>
<td>: <asp:Label ID="lb_ownerName" runat="server" Text='<%# Eval("name") %>'></asp:Label></td>
<td>Date of Issue</td>
<td>: <asp:Label ID="lb_issueDate" runat="server" Text='<%# Eval("issue_date") %>'></asp:Label></td>
</tr>

<tr>
<td>Plan</td>
<td>: Flexi Protect</td>
<td>Policy No.</td>
<td>: <asp:Label ID="lb_policyNo" runat="server" Text='<%# Eval("policy_no") %>'></asp:Label></td>
</tr>

<tr>
<td>Basic Sum Insured (S$)</td>
<td>: <asp:Label ID="lb_basicSumInsured" runat="server" Text='<%# Eval("basic_sum_insured") %>'></asp:Label></td>
<td> <asp:Label ID="lb_gender" runat="server" Text='<%# Eval("gender") %>'></asp:Label>,
     <asp:Label ID="lb_smokeStatus" runat="server" Text='<%# Eval("smoker") %>'></asp:Label></td>
<td></td>
</tr>

<tr>
<td>Total Annual Premium (S$)</td>
<td>: <asp:Label ID="lb_totalAnnualPremium" runat="server" Text='<%# Eval("total_annual_premium") %>'></asp:Label></td>
<td>Age Last Birthday</td>
<td>: <asp:Label ID="lb_ageLastBirthday" runat="server" Text='<%# Eval("age") %>'></asp:Label></td>
</tr>

<tr>
<td>Benefit Type</td>
<td>: <asp:Label ID="lb_benefitType" runat="server" Text='<%# Eval("benefit_type") %>'></asp:Label></td>
<td></td>
<td></td>
</tr>
</table>
<br />
<table class="tbl_premiumSummary" width="100%">
<tr>
<td colspan="5" style="text-align: center; font-weight: bold; font-size: 20px;">Premium Summary</td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>

<tr>
<td class="borderTopBottom"></td>
<td class="borderTopBottom">Sum Insured</td>
<td class="borderTopBottom">Monthly</td>
<td class="borderTopBottom">Semi-Annual</td>
<td class="borderTopBottom">Annually</td>
</tr>

<tr>
<td>Basic Plan</td>
<td><asp:Label ID="lb_sumInsuredBasic" runat="server" Text='<%# Eval("basic_sum_insured") %>'></asp:Label></td>
<td><asp:Label ID="lb_basicPremiumMonthly" runat="server" Text='<%# Eval("m_basic_premium") %>'></asp:Label></td>
<td><asp:Label ID="lb_basicPremiumSemiAnnually" runat="server" Text='<%# Eval("s_basic_premium") %>'></asp:Label></td>
<td><asp:Label ID="lb_basicPremiumAnnually" runat="server" Text='<%# Eval("a_basic_premium") %>'></asp:Label></td>
</tr>

<tr>
<td>Critical Care Plus Rider</td>
<td><asp:Label ID="lb_sumInsuredPlusRider" runat="server" Text='<%# Eval("plus_rider_sum_insured") %>'></asp:Label></td>
<td>-</td>
<td>-</td>
<td>-</td>
</tr>

<tr>
<td>Critical Care Waiver Rider</td>
<td></td>
<td><asp:Label ID="lb_waiverPremiumMonthly" runat="server" Text='<%# Eval("m_waiver_rider_premium") %>'></asp:Label></td>
<td><asp:Label ID="lb_waiverPremiumSemiAnnually" runat="server" Text='<%# Eval("s_waiver_rider_premium") %>'></asp:Label></td>
<td><asp:Label ID="lb_waiverPremiumAnnually" runat="server" Text='<%# Eval("waiver_rider_premium") %>'></asp:Label></td>
</tr>

<tr>
<td class="borderTop">Total Premium</td>
<td class="borderTop"></td>
<td class="borderTop"><asp:Label ID="lb_totalPremiumMonthly" runat="server" Text='<%# Eval("m_total_annual_premium") %>'></asp:Label></td>
<td class="borderTop"><asp:Label ID="lb_totalPremiumSemiAnnually" runat="server" Text='<%# Eval("s_total_annual_premium") %>'></asp:Label></td>
<td class="borderTop"><asp:Label ID="lb_totalPremiumAnnually" runat="server" Text='<%# Eval("total_annual_premium") %>'></asp:Label></td>
</tr>

<tr>
<td class="borderBottom">Monthly-GIRO premium</td>
<td class="borderBottom"></td>
<td class="borderBottom"></td>
<td class="borderBottom"></td>
<td class="borderBottom"><asp:Label ID="lb_giroPremiumPayment" runat="server" Text='<%# Eval("m_total_annual_premium") %>'></asp:Label></td>
</tr>
</table>
<br />
<p style="font-size: 14px">Acknowledgement of Product Summary:<br /> <br />
I confirm that I have received a copy of the Product Summary (11 pages in total) for the Basic Plan and Riders (if any) listed above.<br /> <br />
The Representative(s) has/have explained the information, including the key benefits, fees and charges and key product provisions, as set out in the Product Summary to my satisfaction.<br /> <br />
I have also read through all the pages of the Product Summary and understand the benefits and key product provisions of the Basic Plan and Riders (if any).</p>
<br /><br /><br />

<table class="tbl_signature" width="100%">
<tr>
<td></td>
<td></td>
<td style="width:50%"></td>
<td></td>
<td></td>
</tr>

<tr>
<td style="border-top-style: solid; border-width: thin; text-align: center;">
    <asp:Label ID="lb_clientName" runat="server" Text='<%# Eval("name") %>'></asp:Label></td>
<td style="border-top-style: solid; border-width: thin; text-align: center;">Date</td>
<td></td>
<td style="border-top-style: solid; border-width: thin; text-align: center;"">
    <asp:Label ID="lb_staffName" runat="server" Text=""></asp:Label><br />WorldTrade Representative</td>
<td style="border-top-style: solid; border-width: thin; text-align: center;"">Date</td>
</tr> <%----%>
</table>
<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb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" />--%>
<img alt="Print Certificate"
    src="../../Retirement/Images/print.gif" onclick="PrintElem();" Width="50" />
</div>
</ItemTemplate>
</asp:FormView>
    <asp:SqlDataSource ID="SqlDataSource_Certificate" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
        
        SelectCommand="SELECT C.firstName + ' ' + C.lastName AS name, C.gender, DATEDIFF(year, C.dob, { fn NOW() }) AS age, 
        case when C.smoker='N' then 'Non-Smoker' when C.smoker='Y' then 'Smoker'end AS smoker, P.policy_no, P.user_id, P.accountID,
        Convert(varchar(10),CONVERT(date,P.issue_date,106),103) AS issue_date, P.benefit_type, P.staff_id, 
        convert(nvarchar(15), cast(P.basic_sum_insured as money), 1) AS basic_sum_insured, 
        convert(nvarchar(15), cast(P.plus_rider_sum_insured as money), 1) AS plus_rider_sum_insured, 
        convert(nvarchar(15), cast((P.total_annual_premium - P.waiver_rider_premium) / 12 as money), 1) AS m_basic_premium, 
        convert(nvarchar(15), cast((P.total_annual_premium - P.waiver_rider_premium) / 2 as money), 1) AS s_basic_premium, 
        convert(nvarchar(15), cast(P.total_annual_premium - P.waiver_rider_premium as money), 1) AS a_basic_premium, 
        convert(nvarchar(15), cast(P.waiver_rider_premium / 12 as money), 1) AS m_waiver_rider_premium, 
        convert(nvarchar(15), cast(P.waiver_rider_premium / 2 as money), 1) AS s_waiver_rider_premium, 
        convert(nvarchar(15), cast(P.waiver_rider_premium as money), 1) AS waiver_rider_premium, 
        convert(nvarchar(15), cast(P.total_annual_premium / 12 as money), 1) AS m_total_annual_premium, 
        convert(nvarchar(15), cast(P.total_annual_premium / 2 as money), 1) AS s_total_annual_premium, 
        convert(nvarchar(15), cast(P.total_annual_premium as money), 1) AS total_annual_premium, 
        P.premium_frequency, P.payment_method, P.status FROM R_POLICY AS P INNER JOIN Customer AS C ON P.user_id = C.userID WHERE (P.policy_no = @policyNo)">
        <SelectParameters>
            <asp:QueryStringParameter Name="policyNo" QueryStringField="policyNo" DefaultValue="FP2013"
                Type="String" />
        </SelectParameters>
    </asp:SqlDataSource>

</asp:Content>

